home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
system
/
ints.zip
/
INTS.ASM
< prev
next >
Wrap
Assembly Source File
|
1988-02-21
|
4KB
|
246 lines
PAGE 60,132
TITLE INTS.ASM - A program to list interrupt vectors
;INTS.ASM
; This program should list the interrupt vectors found in page zero.
; It runs under DOS 3.2, and should work with all 3.x versions -
; I think that the only thing that makes it version dependent is the
; terminate with return code function.
;
; Steve Conklin - 12/6/86
; uunet!ingr!tesla!steve
; Intergraph Corp. (205) 772-6888
;
;
CRLF EQU 0D0AH
DATA_SEG SEGMENT
XLAT_TABLE DB '0123456789ABCDEF'
HEADER DB 'Listing of interrupt vectors for MS-DOS'
DW CRLF
DW CRLF
DB 'Vectors containing 0000:0000 will not be listed.'
DW CRLF
DW CRLF
DB 'INT VECTOR'
DW CRLF
DB '--- ------'
DW CRLF
DB '$'
INT_MSG DB ' '
INT_VAL DB 'XX'
DB ' - '
VEC_SEG DB 'XXXX:'
VEC_OFF DB 'XXXX'
DB '$'
IRET_MSG DB ' --> IRET'
DB '$'
DATA_SEG ENDS
CODE_SEG SEGMENT
ASSUME CS:CODE_SEG,DS:DATA_SEG
START:
MOV AX,DATA_SEG ;set up data segment register
MOV DS,AX
MOV DX,OFFSET HEADER ;offset of sign-on
MOV AH,09H ;request 09 - send string to std out
INT 21H ;print it
MOV AL,00 ;start with int vector 00
DO_IT:
MOV AH,35h ;int 21h request 35h - return vector
MOV DI,OFFSET INT_VAL ;Put INT value in string
CALL BYTEHEX ;
INT 21H
PUSH AX ;see if vector is 0000:0000
PUSH ES ;and don't print it if it is
POP AX ;
CMP AX,0000H ;
JNE O_K ;
MOV AX,BX ;
CMP AX,0000H ;
JNE O_K ;
POP AX ;
JMP SKIP_IT ;
O_K: POP AX ;
PUSH AX
MOV AX,ES ;get vector CS in AX
MOV DI,OFFSET VEC_SEG ;convert and put in string
CALL BINHEX ;
MOV AX,BX ;get vector IP in AX
MOV DI,OFFSET VEC_OFF ;convert and put in string
CALL BINHEX ;
MOV AH,09H ;print string to std out
MOV DX,OFFSET INT_MSG
INT 21H ;print it
;see if vector points to an IRET, and print something if it does.
MOV AX,ES:[BX] ;get the word at ES:BX
CMP AL,0CFH ;IRET is CF hex
JNE FINI
MOV AH,09H ;print string to std out
MOV DX,OFFSET IRET_MSG
INT 21H ;print it
;finish up
FINI:
CALL SEND_CRLF ;print a newline
POP AX
SKIP_IT:
CMP AL,255
JE DONE
INC AL
JMP DO_IT
DONE:
MOV AH,4CH ;terminate process
MOV AL,00H ;normal return code
INT 21H
; SEND_CRLF will send a carriage return and line feed to std out
SEND_CRLF PROC NEAR
PUSH AX
PUSH DX
MOV AH,02H ;send char to active display
MOV DL,0DH ;carriage return
INT 21H ;do it
MOV DL,0AH ;line feed
INT 21H ;do it
POP DX
POP AX
RET
SEND_CRLF ENDP
; BINHEX will take the value in AX and convert it into four hex ASCII
; bytes and put them at the location given in DS:DI, MSB first.
BINHEX PROC NEAR
PUSH BX
PUSH CX
PUSH DX
PUSH ES
PUSH AX
PUSH AX
MOV AX,DS ;ES is segment for string store instruction
MOV ES,AX ;so copy DS there
POP AX
MOV BX,OFFSET XLAT_TABLE ;set up for translation
CLD ;make sure direction is set to inc DI
MOV DX,AX ;save a copy
MOV AL,DH ;then get the high byte into AL
MOV CL,4 ;and shift the most sig. nybble into
SHR AL,CL ;the low nybble of AL (SHR shifts in zeros)
XLAT XLAT_TABLE ;do the translation
STOSB ;move AL to ES:DI
MOV AL,DH ;get a copy of the next nybble into AL
AND AL,0FH ;and isolate it
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;third nybble
MOV CL,4 ;shift it
SHR AL,CL
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;least significant nybble
AND AL,0FH ;isolate
XLAT XLAT_TABLE
STOSB
POP AX
POP ES
POP DX
POP CX
POP BX
RET
BINHEX ENDP
; Bytehex will take the value in AL and convert it into two hex ASCII
; bytes and put them at the location given in DI, MSB first.
BYTEHEX PROC NEAR
PUSH BX
PUSH CX
PUSH DX
PUSH ES
PUSH AX
PUSH AX
MOV AX,DS ;ES is segment for string store instruction
MOV ES,AX ;
POP AX
MOV BX,OFFSET XLAT_TABLE ;set up for translation
CLD ;make sure direction is set to inc DI
MOV DX,AX ;save a copy
MOV AL,DL ;first nybble
MOV CL,4 ;shift it
SHR AL,CL
XLAT XLAT_TABLE
STOSB
MOV AL,DL ;last nybble
AND AL,0FH ;isolate
XLAT XLAT_TABLE
STOSB
POP AX
POP ES
POP DX
POP CX
POP BX
RET
BYTEHEX ENDP
CODE_SEG ENDS
END START ;Make sure we start at "START" first time.